﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Benchmarks.ListCreation;

namespace Benchmarks
{
    class Program
    {
        static void ExecuteSuite( BenchmarkSuite suite ) {

            List<BenchmarkResults> results = Benchmarker.ExecuteSuite(suite);
            StringBuilder sb = new StringBuilder();

            int last_run_count = 0;
            foreach (BenchmarkResults result in results)
            {
                if (result.RunCount != last_run_count)
                {
                    last_run_count = result.RunCount;
                    sb.AppendLine();
                }
                sb.AppendLine(result.ToString());
            }

            File.WriteAllText(@"C:\BENCHMARKS\" + suite.Category + ".txt", sb.ToString());
            Console.WriteLine(sb.ToString());

            Console.WriteLine(@"C:\BENCHMARKS\" + suite.Category + ".txt");
        }
        static void Main(string[] args) {
            ExecuteSuite(new MethodInvocationSuite());
            ExecuteSuite(new AssociateVsIndexSuite());
            ExecuteSuite(new ListCreationSuite());
            ExecuteSuite(new BoxingSuite());
            Console.ReadKey();
        }
    }
}
